package com.yanyu.space.common.sleuth.rocket;

import com.yanyu.space.common.core.util.AppContext;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.stream.messaging.DirectWithAttributesChannel;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.ChannelInterceptor;

/**
 * @author gz
 */
public class StreamBridgeInterceptor implements ChannelInterceptor {
    private Tracer tracer = AppContext.getBean(Tracer.class);
    @Override
    public Message<?> preSend(Message<?> msg, MessageChannel mc) {
        DirectWithAttributesChannel newChannel = (DirectWithAttributesChannel)mc;
        newChannel.getAttribute("");
//        tracer.currentSpan().tag("")
        return msg;
    }
}
